<?php

use Illuminate\Routing\Router;

Admin::registerAuthRoutes();

Route::group([
    'prefix' => config('admin.route.prefix'),
    'namespace' => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {
    $router->get('/', 'HomeController@index');

    //用户管理
    $router->resource('users', 'UsersController');

    //用户管理重置密码
    $router->match(['get', 'put'], 'reset_password/{id}', 'UsersController@resetPassword')->name('admin.user.password');

    //banner管理
    $router->resource('banners', 'BannersController');

    //商家管理
    $router->resource('sellers', 'SellersController');

    //商家管理重置密码
    $router->match(['get', 'put'], 'seller_reset_password/{id}', 'SellersController@resetPassword')->name('admin.user.password');

    //设置冻结/解冻
    $router->post('set_user_login_status', 'ApiController@setUserLoginStatus')->name('admin.set.login.status');

    //设置禁言/解禁
    $router->post('set_user_gag_status', 'ApiController@setUserGagStatus')->name('admin.set.gag.status');

    //商店管理
    $router->resource('shops', 'ShopsController');

    //省管理
    $router->resource('sys_province', 'SysProvinceController');

    //市管理
    $router->resource('sys_city', 'SysCityController');

    //区管理
    $router->resource('sys_district', 'SysDistrictController');

    //产品管理
    $router->resource('products', 'ProductsController');

    //充值消费记录
    $router->resource('log_balance', 'LogBalanceController');

    //套餐管理
    $router->resource('packages', 'PackagesController');

    //资讯
    $router->resource('news', 'NewsController');

    //帖子管理
    $router->resource('posts', 'PostsController');

    //评论管理
    $router->resource('comments', 'CommentsController');

    //禁言列表
    $router->resource('gag_list', 'GagsController');

    //订单列表
    $router->resource('orders', 'OrdersController');

    //帮助中心
    $router->resource('help_center', 'HelpCenterController');

    //帮助文档
    $router->resource('help_reply', 'HelpReplyController');

    //汇率管理
    $router->resource('exchange_rates', 'ExchangeRatesController');

    //充值记录
    $router->resource('top_up_apply', 'TopUpController');

    //推荐设置
    $router->post('set_recommend', 'ApiController@setRecommend')->name('admin.set.recommend');

    //充值
    $router->post('top_up', 'ApiController@topUp')->name('admin.top_up');

    //退款
    $router->post('refund', 'ApiController@refund')->name('admin.refund');

    //退款
    $router->resource('withdraws', 'WithdrawController');

    //支付方式
    $router->resource('pay_method', 'PayMethodController');
});

//公用接口组 通过以下接口的角色用户不需要授权
Route::group([
    'prefix' => config('admin.route.prefix'),
    'namespace' => config('admin.route.namespace'),
], function (Router $router) {

    $router->group([
        'prefix' => 'api',
    ], function (Router $router) {
        //获取省数据
        $router->get('province', 'ApiController@province')->name('admin.api.province');

        //获取市数据
        $router->get('city', 'ApiController@city')->name('admin.api.city');

        //获取区数据
        $router->get('district', 'ApiController@district')->name('admin.api.district');
    });
});
